package com.woniu.order.controller;


import cn.hutool.core.bean.BeanUtil;
import com.woniu.model.Result;
import com.woniu.order.form.AddUserCommentForm;
import com.woniu.order.model.OrderComment;
import com.woniu.order.param.AddUserCommentParam;
import com.woniu.order.service.OrderCommentService;
import com.woniu.order.util.RedisUtil;
import com.woniu.utils.JwtUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 吴彦祖
 * @since 2024年05月23日
 */
@RestController
@RequestMapping("/orderComment")
//@Api(tags = "用户评论服务")
public class OrderCommentController {

    @Resource
    private RedisUtil redisUtil;

    @Resource
    private OrderCommentService orderCommentService;

//    /**
//     * 用户评价
//     * @param form 订单号 用户评价 用户评星
//     * @param token
//     * @return 评论对象
//     */
//    @ApiOperation("用户评论")
//    @PostMapping("/userComment")
//    public Result<OrderComment> userComment(@RequestBody AddUserCommentForm form, @RequestHeader("token") String token) throws Exception {
//        String refreshToken = redisUtil.get(token);
//        Integer userId = Integer.parseInt(JwtUtil.parseToken(refreshToken,"jlsdjfksdninfghfdgnkjnsuihfjsammjiaakiakaakakk").get("id").toString());
//        OrderComment o = orderCommentService.userComment(BeanUtil.toBean(form, AddUserCommentParam.class),userId);
//        return Result.newInstance(OrderComment.class).setData(o).setMessage("评论成功");
//    }

}

